/*
 * @(#)CityDAO.java
 * Copyright (c) 2011 TravelSky Technology Ltd. All Right Reserved. 
 */
package com.meetingshow.meeting.dao;

import java.util.List;

import com.meetingshow.common.base.dao.BaseDAO;
import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.model.QueryResults;
import com.meetingshow.meeting.dao.model.CityPO;

public class CityDAO extends BaseDAO {

    public void saveCity(CityPO cityPO) throws Exception {
        this.saveBaseObj(cityPO);
    }

    public void updateCity(CityPO cityPO) throws Exception {
        this.updateBaseObj(cityPO);
    }

    public void removeCity(CityPO cityPO) throws Exception {
        this.deleteBaseObj(cityPO);
    }
    
    public CityPO getCityById (java.lang.Integer cityId) throws Exception {
        return this.queryById(CityPO.class, cityId);
    }

    public QueryResults<CityPO> queryCity(QueryStruct queryStruct) throws Exception {
        QueryResults<CityPO> queryResults = new QueryResults<CityPO>();
        List<CityPO> resultList = findByParameter(queryStruct);
        queryResults.setResultList(resultList);
        if (queryStruct.getFirstResultNo() != null
                && queryStruct.getResultsPerGroup() != null) {
            queryResults = queryPageInfo(queryStruct, queryResults);
        } else {
            queryResults.setTotalResultsNum(Long.valueOf(resultList.size()));
        }
        return queryResults;
    }
}